package com.eduplatform.dto;

import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 课件笔记DTO
 */
@Data
public class MaterialDTO {

    private Long id;

    @NotBlank(message = "标题不能为空")
    private String title;

    private String content;

    @NotNull(message = "类型不能为空")
    private Integer type;

    private String fileUrl;

    private String coverUrl;

    private Long userId;

    private String userName;

    @NotNull(message = "教育阶段不能为空")
    private Integer educationLevel;

    private String educationLevelName;

    @NotNull(message = "学科不能为空")
    private Long subjectId;

    private String subjectName;

    private Long schoolId;

    private String schoolName;

    private Date createTime;

    private Date updateTime;

    /**
     * 获取教育阶段名称
     */
    public String getEducationLevelName() {
        if (educationLevel == null) {
            return "";
        }
        switch (educationLevel) {
            case 1:
                return "小学";
            case 2:
                return "初中";
            case 3:
                return "高中";
            case 4:
                return "大学";
            default:
                return "未知";
        }
    }

    /**
     * 获取类型名称
     */
    public String getTypeName() {
        if (type == null) {
            return "";
        }
        switch (type) {
            case 1:
                return "课件";
            case 2:
                return "笔记";
            default:
                return "未知";
        }
    }
}